package com.shenganyuan.smac.common.view;

import android.content.Context;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;

import com.shenganyuan.smac.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;
import butterknife.Unbinder;


/**
 * @author Damon
 */
public class DialogWorkOperate extends BottomDialogBase {
    @BindView(R.id.btn_patrol_record)
    TextView btnPatrolRecord;
    @BindView(R.id.btn_hazard_record)
    TextView btnHazardRecord;
    @BindView(R.id.btn_correct_record)
    TextView btnCorrectRecord;
    @BindView(R.id.btn_builder_record)
    TextView btnBuilderRecord;
    @BindView(R.id.btn_sign_in)
    TextView btnSignIn;
    @BindView(R.id.btn_scan)
    TextView btnScan;
    Unbinder unbinder;
    private Context mContext;

    public static DialogWorkOperate netInstance() {
        DialogWorkOperate dialog4CustomerAttachment = new DialogWorkOperate();
        Bundle extras = new Bundle();
        dialog4CustomerAttachment.setArguments(extras);
        return dialog4CustomerAttachment;
    }

    @Override
    public void init() {
        mContext = getContext();
        View mainView = LayoutInflater.from(getContext()).inflate(R.layout.main_work_bottom_operate, null, false);
        addDialogBody(mainView);
        unbinder = ButterKnife.bind(this, mainView);
        hideBottom();
    }

    @Override
    public void onResume() {
        super.onResume();
        int dialogHeight = (int) (getScreenSize(getActivity())[1] * 0.4);
        resetDialogHeight(-2);
    }

    @OnClick({ R.id.btn_patrol_record, R.id.btn_hazard_record, R.id.btn_correct_record, R.id.btn_builder_record, R.id.btn_sign_in, R.id.btn_scan})
    public void onViewClicked(View view) {
        if (onWorkOperationClicked != null) {
            onWorkOperationClicked.onOperationClicked(view);
        }
        dismiss();
    }

    public void setOnWorkOperationClicked(OnWorkOperationClicked onWorkOperationClicked) {
        this.onWorkOperationClicked = onWorkOperationClicked;
    }

    private OnWorkOperationClicked onWorkOperationClicked;


    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }

    public interface OnWorkOperationClicked {
        void onOperationClicked(View view);
    }

}
